home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d18
/
nrpas13.arc
/
EIGSRT.DEM
< prev
next >
Wrap
Text File
|
1991-05-01
|
3KB
|
85 lines
PROGRAM d11r2(input,output);
(* driver for routine EIGSRT *)
CONST
np=10;
TYPE
glnpnp = ARRAY [1..np,1..np] OF real;
glnp = ARRAY [1..np] OF real;
VAR
i,j,nrot : integer;
c,v : glnpnp;
d : glnp;
(*$I MODFILE.PAS *)
(*$I JACOBI.PAS *)
(*$I EIGSRT.PAS *)
BEGIN
c[1,1] := 5.0; c[1,2] := 4.0; c[1,3] := 3.0;
c[1,4] := 2.0; c[1,5] := 1.0; c[1,6] := 0.0;
c[1,7] := -1.0; c[1,8] := -2.0; c[1,9] := -3.0;
c[1,10] := -4.0;
c[2,1] := 4.0; c[2,2] := 5.0; c[2,3] := 4.0;
c[2,4] := 3.0; c[2,5] := 2.0; c[2,6] := 1.0;
c[2,7] := 0.0; c[2,8] := -1.0; c[2,9] := -2.0;
c[2,10] := -3.0;
c[3,1] := 3.0; c[3,2] := 4.0; c[3,3] := 5.0;
c[3,4] := 4.0; c[3,5] := 3.0; c[3,6] := 2.0;
c[3,7] := 1.0; c[3,8] := 0.0; c[3,9] := -1.0;
c[3,10] := -2.0;
c[4,1] := 2.0; c[4,2] := 3.0; c[4,3] := 4.0;
c[4,4] := 5.0; c[4,5] := 4.0; c[4,6] := 3.0;
c[4,7] := 2.0; c[4,8] := 1.0; c[4,9] := 0.0;
c[4,10] := -1.0;
c[5,1] := 1.0; c[5,2] := 2.0; c[5,3] := 3.0;
c[5,4] := 4.0; c[5,5] := 5.0; c[5,6] := 4.0;
c[5,7] := 3.0; c[5,8] := 2.0; c[5,9] := 1.0;
c[5,10] := 0.0;
c[6,1] := 0.0; c[6,2] := 1.0; c[6,3] := 2.0;
c[6,4] := 3.0; c[6,5] := 4.0; c[6,6] := 5.0;
c[6,7] := 4.0; c[6,8] := 3.0; c[6,9] := 2.0;
c[6,10] := 1.0;
c[7,1] := -1.0; c[7,2] := 0.0; c[7,3] := 1.0;
c[7,4] := 2.0; c[7,5] := 3.0; c[7,6] := 4.0;
c[7,7] := 5.0; c[7,8] := 4.0; c[7,9] := 3.0;
c[7,10] := 2.0;
c[8,1] := -2.0; c[8,2] := -1.0; c[8,3] := 0.0;
c[8,4] := 1.0; c[8,5] := 2.0; c[8,6] := 3.0;
c[8,7] := 4.0; c[8,8] := 5.0; c[8,9] := 4.0;
c[8,10] := 3.0;
c[9,1] := -3.0; c[9,2] := -2.0; c[9,3] := -1.0;
c[9,4] := 0.0; c[9,5] := 1.0; c[9,6] := 2.0;
c[9,7] := 3.0; c[9,8] := 4.0; c[9,9] := 5.0;
c[9,10] := 4.0;
c[10,1] := -4.0; c[10,2] := -3.0; c[10,3] := -2.0;
c[10,4] := -1.0; c[10,5] := 0.0; c[10,6] := 1.0;
c[10,7] := 2.0; c[10,8] := 3.0; c[10,9] := 4.0;
c[10,10] := 5.0;
jacobi(c,np,d,v,nrot);
writeln('unsorted eigenvectors:');
FOR i := 1 to np DO BEGIN
writeln('eigenvalue',i:3,' := ',d[i]:12:6);
writeln('eigenvector:');
FOR j := 1 to np DO BEGIN
write(v[j,i]:12:6);
IF ((j MOD 5) = 0) THEN writeln
END;
writeln
END;
writeln;
writeln('****** sorting ******');
writeln;
eigsrt(d,v,np);
writeln('sorted eigenvectors:');
FOR i := 1 to np DO BEGIN
writeln('eigenvalue',i:3,' := ',d[i]:12:6);
writeln('eigenvector:');
FOR j := 1 to np DO BEGIN
write(v[j,i]:12:6);
IF ((j MOD 5) = 0) THEN writeln
END;
writeln
END
END.